<?php
/* 
 * Copyright (c) 2018-2021   All rights reserved.
 *
 * 创建时间：2021-11-22 14:10:09
 *
 * 项目：/levfm  -  $  - BaseUserFormModel.php
 *
 * 作者：{{AUTO GENERATE}}
 */

//此文件使用程序自动生成，下次生成时会覆盖，不建议修改。

namespace modules\levfm\table\form\Form_levfm_fields\_gen;

use Lev;
use lev\base\Modelv;
use lev\base\SubModelv;

!defined('INLEV') && exit('Access Denied LEV');


class BaseForm_levfm_fields extends SubModelv
{

    public static $tableName = '{{%levfm_fields}}';

    public static function safeColumnsGen($columns)
    {
        $allColumns = static::allColumns();
        if (is_array($allColumns)) {
            foreach ($columns as $field => $value) {
                if (!isset($allColumns[$field])) unset($columns[$field]);
            }
        }
        return parent::safeColumnsGen($columns); // TODO: Change the autogenerated stub
    }

    public static function allColumns() {
        return array(
                'id'           => 'Id',

                'formid'       => '关联表单ID',

                'classify'     => '字段分类',

                'title'        => '标题',

                'placeholder'  => '字段提示',

                'inputname'    => '字段名',

                'inputtype'    => '字段类型',

                'inputvalue'   => '字段默认值',

                'settings'     => '通用设置',

                'rules'        => '字段校验规则',

                'displayorder' => '排序',

                'status'       => '状态',

                'uptime'       => '更新时间',

                'addtime'      => '添加时间',

        );
    }

    public static function inputs($iden = '', $keyfield = '', $classify = null)
    {
        //return parent::inputs($iden, $keyfield, $classify); // TODO: Change the autogenerated stub
        return array(
                'formid'                     => array(
                    'moduleidentifier' => 'levfm',
                    'classify'         => 'levfm_fields',
                    'title'            => '所属表单ID',
                    'placeholder'      => '',
                    'inputname'        => 'formid',
                    'inputtype'        => 'selectcode',
                    'inputvalue'       => '',
                    'settings'         => 'modules\\levfm\\table\\form\\Form_levfm_fields\\Form_levfm_fields',
                    'displayorder'     => '0',
                    'status'           => '1',
            ),

                'classify'                   => array(
                    'moduleidentifier' => 'levfm',
                    'classify'         => 'levfm_fields',
                    'title'            => '字段分类',
                    'placeholder'      => '',
                    'inputname'        => 'classify',
                    'inputtype'        => 'textSelect',
                    'inputvalue'       => '',
                    'settings'         => 'modules\\levfm\\table\\form\\Form_levfm_fields\\Form_levfm_fields',
                    'displayorder'     => '0',
                    'status'           => '1',
            ),

                'settings__tmp_field'        => array(
                    'moduleidentifier' => 'levfm',
                    'classify'         => 'levfm_fields',
                    'title'            => '字段模板',
                    'placeholder'      => '字段模板与类型相关，某些类型不能使用模板',
                    'inputname'        => 'settings__tmp_field',
                    'inputtype'        => 'selectcode',
                    'inputvalue'       => '',
                    'settings'         => 'modules\\levfm\\table\\form\\Form_levfm_fields\\Form_levfm_fields',
                    'displayorder'     => '0',
                    'status'           => '1',
            ),

                'title'                      => array(
                    'moduleidentifier' => 'levfm',
                    'classify'         => 'levfm_fields',
                    'title'            => '字段标题',
                    'placeholder'      => '必填，',
                    'inputname'        => 'title',
                    'inputtype'        => 'text',
                    'inputvalue'       => '',
                    'settings'         => '',
                    'displayorder'     => '2',
                    'status'           => '1',
            ),

                'inputtype'                  => array(
                    'moduleidentifier' => 'levfm',
                    'classify'         => 'levfm_fields',
                    'title'            => '字段类型',
                    'placeholder'      => '',
                    'inputname'        => 'inputtype',
                    'inputtype'        => 'selectcode',
                    'inputvalue'       => '',
                    'settings'         => 'modules\\levfm\\table\\form\\Form_levfm_fields\\Form_levfm_fields',
                    'displayorder'     => '3',
                    'status'           => '1',
            ),

                'settings__set_uploadimg'    => array(
                    'moduleidentifier' => 'levfm',
                    'classify'         => 'levfm_fields',
                    'title'            => '图片上传【设置】',
                    'placeholder'      => '',
                    'inputname'        => 'settings__set_uploadimg',
                    'inputtype'        => 'tabletrForm',
                    'inputvalue'       => '',
                    'settings'         => array(
                        'tablesForm' => array(
                            '1' => array(
                                'id'          => 1,
                                'order'       => '1',
                                'title'       => '图片大小[M]',
                                'inputname'   => 'maxsize',
                                'inputtype'   => 'text',
                                'width'       => '100',
                                'settings'    => '',
                                'placeholder' => '【注意】上传大小仅支持【M】单位，否则一律按【KB】计算',
                                'inputvalue'  => '5M',
                        ),
                            '2' => array(
                                'id'          => 2,
                                'order'       => '2',
                                'title'       => '图片宽度[px]',
                                'inputname'   => 'width',
                                'inputtype'   => 'text',
                                'width'       => '100',
                                'settings'    => '',
                                'placeholder' => '留空不限制',
                                'inputvalue'  => '',
                        ),
                            '3' => array(
                                'id'          => 3,
                                'order'       => '3',
                                'title'       => '图片高度[px]',
                                'inputname'   => 'height',
                                'inputtype'   => 'text',
                                'width'       => '100',
                                'settings'    => '',
                                'placeholder' => '留空不限制',
                                'inputvalue'  => '',
                        ),
                            '4' => array(
                                'id'          => 4,
                                'order'       => '4',
                                'title'       => '图片格式',
                                'inputname'   => 'exts',
                                'inputtype'   => 'text',
                                'width'       => '',
                                'settings'    => '',
                                'placeholder' => '多个用【=】等号分隔。例：“jpg=png=jpeg=gif”',
                                'inputvalue'  => 'jpg=png=jpeg=gif=bmp',
                        ),
                    ),
                ),
                    'displayorder'     => '4',
                    'status'           => '1',
            ),

                'settings__set_textSelect'   => array(
                    'moduleidentifier' => 'levfm',
                    'classify'         => 'levfm_fields',
                    'title'            => '下拉框【选项】设置',
                    'placeholder'      => '',
                    'inputname'        => 'settings__set_textSelect',
                    'inputtype'        => 'tablesForm',
                    'inputvalue'       => '',
                    'settings'         => array(
                        'tablesForm' => array(
                            '1' => array(
                                'id'          => 1,
                                'order'       => '1',
                                'title'       => '排序',
                                'inputname'   => 'order',
                                'inputtype'   => 'number',
                                'width'       => '50',
                                'settings'    => '',
                                'placeholder' => '',
                                'inputvalue'  => '',
                        ),
                            '2' => array(
                                'id'          => 2,
                                'order'       => '2',
                                'title'       => 'ID选项值',
                                'inputname'   => 'id',
                                'inputtype'   => 'number',
                                'width'       => '80',
                                'settings'    => '',
                                'placeholder' => '',
                                'inputvalue'  => '',
                        ),
                            '3' => array(
                                'id'          => 3,
                                'order'       => '3',
                                'title'       => '选项名称',
                                'inputname'   => 'title',
                                'inputtype'   => 'text',
                                'width'       => '100',
                                'settings'    => '',
                                'placeholder' => '留空显示ID，ID号为选项存储值',
                                'inputvalue'  => '',
                        ),
                            '4' => array(
                                'id'          => 4,
                                'order'       => '4',
                                'title'       => '开关',
                                'inputname'   => 'status',
                                'inputtype'   => 'radio',
                                'width'       => '40',
                                'settings'    => '',
                                'placeholder' => '遗弃选项建议关闭，不建议删除
关闭选项管理员可见，普通会员不可见',
                                'inputvalue'  => '',
                        ),
                            '5' => array(
                                'id'          => 5,
                                'order'       => '5',
                                'title'       => '选项描述',
                                'inputname'   => 'desc',
                                'inputtype'   => 'text',
                                'width'       => '',
                                'settings'    => '',
                                'placeholder' => '',
                                'inputvalue'  => '',
                        ),
                    ),
                ),
                    'displayorder'     => '4',
                    'status'           => '1',
            ),

                'settings__set_tablesForm'   => array(
                    'moduleidentifier' => 'levfm',
                    'classify'         => 'levfm_fields',
                    'title'            => '子表单【字段】设置',
                    'placeholder'      => '',
                    'inputname'        => 'settings__set_tablesForm',
                    'inputtype'        => 'tablesForm',
                    'inputvalue'       => '',
                    'settings'         => array(
                        'tablesForm' => array(
                            '1' => array(
                                'id'          => 1,
                                'order'       => '1',
                                'title'       => '排序',
                                'inputname'   => 'order',
                                'inputtype'   => 'number',
                                'width'       => '50',
                                'settings'    => '',
                                'placeholder' => '',
                                'inputvalue'  => '',
                        ),
                            '2' => array(
                                'id'          => 2,
                                'order'       => '2',
                                'title'       => 'ID字段名',
                                'inputname'   => 'id',
                                'inputtype'   => 'number',
                                'width'       => '80',
                                'settings'    => '',
                                'placeholder' => 'sub_field_{ID}',
                                'inputvalue'  => '',
                        ),
                            '3' => array(
                                'id'          => 3,
                                'order'       => '3',
                                'title'       => '字段标题',
                                'inputname'   => 'title',
                                'inputtype'   => 'text',
                                'width'       => '130',
                                'settings'    => '',
                                'placeholder' => '',
                                'inputvalue'  => '',
                        ),
                            '4' => array(
                                'id'          => 4,
                                'order'       => '4',
                                'title'       => '开关',
                                'inputname'   => 'status',
                                'inputtype'   => 'radio',
                                'width'       => '40',
                                'settings'    => '',
                                'placeholder' => '',
                                'inputvalue'  => '',
                        ),
                            '5' => array(
                                'id'          => 5,
                                'order'       => '5',
                                'title'       => '字段类型[type]',
                                'inputname'   => 'inputtype',
                                'inputtype'   => 'selectcode',
                                'width'       => '100',
                                'settings'    => 'lev\\widgets\\inputs\\tablesForm',
                                'placeholder' => '',
                                'inputvalue'  => '',
                        ),
                            '6' => array(
                                'id'          => 6,
                                'order'       => '6',
                                'title'       => '输入框宽度',
                                'inputname'   => 'width',
                                'inputtype'   => 'text',
                                'width'       => '80',
                                'settings'    => '',
                                'placeholder' => '',
                                'inputvalue'  => '',
                        ),
                            '7' => array(
                                'id'          => 7,
                                'order'       => '7',
                                'title'       => '扩展设置',
                                'inputname'   => 'settings',
                                'inputtype'   => 'textarea',
                                'width'       => '',
                                'settings'    => '',
                                'placeholder' => '',
                                'inputvalue'  => '',
                        ),
                            '8' => array(
                                'id'          => 8,
                                'order'       => '8',
                                'title'       => '字段提示语[placeholder]',
                                'inputname'   => 'placeholder',
                                'inputtype'   => 'textarea',
                                'width'       => '',
                                'settings'    => '',
                                'placeholder' => '#号开头调用icon图标、也可是@别名和url址址',
                                'inputvalue'  => '',
                        ),
                            '9' => array(
                                'id'          => 9,
                                'order'       => '9',
                                'title'       => '字段默认值[value]',
                                'inputname'   => 'inputvalue',
                                'inputtype'   => 'textarea',
                                'width'       => '',
                                'settings'    => '',
                                'placeholder' => '',
                                'inputvalue'  => '',
                        ),
                    ),
                ),
                    'displayorder'     => '4',
                    'status'           => '1',
            ),

                'settings__set_buttons'      => array(
                    'moduleidentifier' => 'levfm',
                    'classify'         => 'levfm_fields',
                    'title'            => '功能按钮【属性】设置',
                    'placeholder'      => '',
                    'inputname'        => 'settings__set_buttons',
                    'inputtype'        => 'tabletrForm',
                    'inputvalue'       => '',
                    'settings'         => array(
                        'tablesForm' => array(
                            '1' => array(
                                'id'          => 1,
                                'order'       => '1',
                                'title'       => '显示类型',
                                'inputname'   => 'ShowType',
                                'inputtype'   => 'select',
                                'width'       => '100',
                                'settings'    => '0=图标
1=文字
2=图标和文字',
                                'placeholder' => '',
                                'inputvalue'  => '',
                        ),
                            '2' => array(
                                'id'          => 2,
                                'order'       => '2',
                                'title'       => '打开方式',
                                'inputname'   => 'target',
                                'inputtype'   => 'selectcode',
                                'width'       => '100',
                                'settings'    => 'lev\\helpers\\SettingsHelper',
                                'placeholder' => '',
                                'inputvalue'  => '',
                        ),
                            '3' => array(
                                'id'          => 3,
                                'order'       => '3',
                                'title'       => '按钮名称',
                                'inputname'   => 'name',
                                'inputtype'   => 'text',
                                'width'       => '100',
                                'settings'    => '',
                                'placeholder' => '',
                                'inputvalue'  => '',
                        ),
                            '5' => array(
                                'id'          => 5,
                                'order'       => '5',
                                'title'       => '按钮图标',
                                'inputname'   => 'logoupload',
                                'inputtype'   => 'textSelect',
                                'width'       => '220',
                                'settings'    => '',
                                'placeholder' => '#号开头调用icon图标、也可是@别名和url址址',
                                'inputvalue'  => '',
                        ),
                            '6' => array(
                                'id'          => 6,
                                'order'       => '6',
                                'title'       => '按钮颜色',
                                'inputname'   => 'bgcolor',
                                'inputtype'   => 'select',
                                'width'       => '77',
                                'settings'    => 'yellow = 金黄色
red    = 红色
blue   = 蓝色
green  = 绿色
gray   = 灰色
black  = 黑色
white  = 白色',
                                'placeholder' => '',
                                'inputvalue'  => '',
                        ),
                            '7' => array(
                                'id'          => 7,
                                'order'       => '7',
                                'title'       => '按钮链接地址',
                                'inputname'   => 'link',
                                'inputtype'   => 'text',
                                'width'       => '',
                                'settings'    => '',
                                'placeholder' => '',
                                'inputvalue'  => '',
                        ),
                    ),
                ),
                    'displayorder'     => '4',
                    'status'           => '1',
            ),

                'settings__set_uploadattach' => array(
                    'moduleidentifier' => 'levfm',
                    'classify'         => 'levfm_fields',
                    'title'            => '指定扩展上传【设置】',
                    'placeholder'      => '',
                    'inputname'        => 'settings__set_uploadattach',
                    'inputtype'        => 'tabletrForm',
                    'inputvalue'       => '',
                    'settings'         => array(
                        'tablesForm' => array(
                            '1' => array(
                                'id'          => 1,
                                'order'       => '1',
                                'title'       => '最大上传[M]',
                                'inputname'   => 'maxsize',
                                'inputtype'   => 'text',
                                'width'       => '100',
                                'settings'    => '',
                                'placeholder' => '【注意】上传大小仅支持【M】单位，否则一律按【KB】计算',
                                'inputvalue'  => '',
                        ),
                            '2' => array(
                                'id'          => 2,
                                'order'       => '2',
                                'title'       => '上传文件格式',
                                'inputname'   => 'exts',
                                'inputtype'   => 'text',
                                'width'       => '',
                                'settings'    => '',
                                'placeholder' => '多个用【=】等号分隔。例：“rar=zip=txt”',
                                'inputvalue'  => 'rar=zip=txt',
                        ),
                    ),
                ),
                    'displayorder'     => '4',
                    'status'           => '1',
            ),

                'placeholder'                => array(
                    'moduleidentifier' => 'levfm',
                    'classify'         => 'levfm_fields',
                    'title'            => '字段提示',
                    'placeholder'      => '',
                    'inputname'        => 'placeholder',
                    'inputtype'        => 'textarea',
                    'inputvalue'       => '',
                    'settings'         => '',
                    'displayorder'     => '6',
                    'status'           => '1',
            ),

                'inputvalue'                 => array(
                    'moduleidentifier' => 'levfm',
                    'classify'         => 'levfm_fields',
                    'title'            => '字段默认值',
                    'placeholder'      => '',
                    'inputname'        => 'inputvalue',
                    'inputtype'        => 'textarea',
                    'inputvalue'       => '',
                    'settings'         => '',
                    'displayorder'     => '6',
                    'status'           => '1',
            ),

                'displayorder'               => array(
                    'moduleidentifier' => 'levfm',
                    'classify'         => 'levfm_fields',
                    'title'            => '排序',
                    'placeholder'      => '',
                    'inputname'        => 'displayorder',
                    'inputtype'        => 'number',
                    'inputvalue'       => '',
                    'settings'         => '',
                    'displayorder'     => '7',
                    'status'           => '1',
            ),

                'rules'                      => array(
                    'moduleidentifier' => 'levfm',
                    'classify'         => 'levfm_fields',
                    'title'            => '字段校验',
                    'placeholder'      => '',
                    'inputname'        => 'rules',
                    'inputtype'        => 'tabletrForm',
                    'inputvalue'       => '',
                    'settings'         => array(
                        'tablesForm' => array(
                            '5' => array(
                                'id'          => 5,
                                'order'       => '2',
                                'title'       => '必填',
                                'inputname'   => 'must',
                                'inputtype'   => 'radio',
                                'width'       => '40',
                                'settings'    => '',
                                'placeholder' => '不能空',
                                'inputvalue'  => '1',
                        ),
                            '3' => array(
                                'id'          => 3,
                                'order'       => '3',
                                'title'       => '最少填写',
                                'inputname'   => 'minLen',
                                'inputtype'   => 'number',
                                'width'       => '100',
                                'settings'    => '',
                                'placeholder' => '留空不限，不能少于多少字，3个字母等于一个汉字',
                                'inputvalue'  => '',
                        ),
                            '4' => array(
                                'id'          => 4,
                                'order'       => '4',
                                'title'       => '最大填写',
                                'inputname'   => 'maxLen',
                                'inputtype'   => 'number',
                                'width'       => '100',
                                'settings'    => '',
                                'placeholder' => '留空不限，限制长度，不能超出多少字',
                                'inputvalue'  => '',
                        ),
                            '2' => array(
                                'id'          => 2,
                                'order'       => '5',
                                'title'       => '唯一',
                                'inputname'   => 'unique',
                                'inputtype'   => 'radio',
                                'width'       => '40',
                                'settings'    => '',
                                'placeholder' => '是否保持字段值不重复',
                                'inputvalue'  => '1',
                        ),
                            '6' => array(
                                'id'          => 6,
                                'order'       => '6',
                                'title'       => '字符校验',
                                'inputname'   => 'dataType',
                                'inputtype'   => 'selectcode',
                                'width'       => '',
                                'settings'    => 'modules\\levfm\\table\\form\\FormData\\fieldValidations',
                                'placeholder' => '',
                                'inputvalue'  => '',
                        ),
                    ),
                ),
                    'displayorder'     => '0',
                    'status'           => '10',
            ),

                'settings__rule_include'     => array(
                    'moduleidentifier' => 'levfm',
                    'classify'         => 'levfm_fields',
                    'title'            => '禁止包含',
                    'placeholder'      => '一行一个。
禁止输入指定关键词
例：“admin manage”等关键词',
                    'inputname'        => 'settings__rule_include',
                    'inputtype'        => 'textarea',
                    'inputvalue'       => '',
                    'settings'         => '',
                    'displayorder'     => '0',
                    'status'           => '10',
            ),

        );
    }

    public static function setupDesc()
    {
        //return parent::setupDesc(); // TODO: Change the autogenerated stub
        return array(
                '1'  => '第1步',

                '10' => '第10步',

        );
    }

    public static function getNextSetup()
    {
        return parent::getNextSetup(); // TODO: Change the autogenerated stub
    }

    public static function inputsSetup()
    {
        return parent::inputsSetup(); // TODO: Change the autogenerated stub
    }

    /**
     * 额外的表单字段，不会存入数据库
     * @return array inputs
     */
    public static function extInputs() {
        return [];
    }

    //eg: <div class="card card-header"></div>
    /**
     * 表单头部htm
     * @return string
     */
    public static function headerHtm() {
        return !Lev::isDeveloper(Lev::$app['iden']) ? '' :
            '<tips class="gray inblk scale8">自定义headerHtm：文件位置：'.__DIR__ . '/Form_levfm_fields.php'.'</tips>';
    }

    /**
     * 表单底部htm
     * <tips class="gray inblk scale8">自定义footerHtm</tips>
     * @return string
     */
    public static function footerHtm() {
        return '';
    }

    /**
     * 表单底部内部htm
     * <tips class="gray inblk scale8">自定义footerFormInnerHtm</tips>
     * @return string
     */
    public static function footerFormInnerHtm() {
        return '';
    }

}